package com.bjb.vr.manager.controller;

import com.alibaba.fastjson.JSONObject;
import com.bjb.vr.common.ao.UmsRoleAo;
import com.bjb.vr.common.result.BaseResult;
import com.bjb.vr.common.result.CommonResult;
import com.bjb.vr.common.service.UmsMenuService;
import com.bjb.vr.common.vo.UmsMenuVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 菜单管理
 *
 * @description:
 * @author: HuJingBo
 * @time: 2022/5/15 17:56
 */
@RestController
@RequestMapping("/api/manager/v1")
public class UmsMenuController {

    @Autowired
    private UmsMenuService umsMenuService;


    /**
     * 查询首页
     *
     * @return
     */
    @PostMapping("/queryHomePage")
    public BaseResult queryHomePage() {
        List<UmsMenuVo> menuVoIPage = umsMenuService.queryHomePage();
        return CommonResult.Ok().setResult(menuVoIPage);
    }

    /**
     * 查询权限菜单
     *
     * @param umsRoleAo
     * @return
     */
    @PostMapping("/queryMenus")
    public BaseResult queryMenus(@RequestBody UmsRoleAo umsRoleAo) {
        List<UmsMenuVo> umsMenuVos = umsMenuService.queryMenus(umsRoleAo);
        return CommonResult.Ok().setResult(umsMenuVos);
    }
}
